/**
 * Crayola colors in JSON format
 * from: https://gist.github.com/jjdelc/1868136
 */
var colors =
[
   
    // {
    //     "hex": "#FCE883",
    //     "label": "Yellow",
    //     "rgb": "(252, 232, 131)"
    // },
    {
        "id": "1",
        "label": "绝缘靴",
    },
    {
        "id": "2",
        "label": "绝缘手套",
    },
    {
        "id": "3",
        "label": "绝缘帽",
    },
    {
        "id": "4",
        "label": "绝缘杆",
    }
];

$(function () {
    $.get('/admin/sampleBasicInfo/searchSample', function (data) {
        $('#nope').autocompleter({
            // marker for autocomplete matches
            highlightMatches: false,

            // object to local or url to remote search
            source: data,

            // custom template
            // template: '{{ label }} <span>({{ hex }})</span>',
            template: '{{ label }}',

            // show hint
            hint: false,

            // abort source if empty field
            empty: false,

            // max results
            limit: 10,

            callback: function (value, index, selected) {
                if (selected) {
                    // $('.icon').css('background-color', selected.hex);
                    // alert(selected.id);

                    // 设置value为pxx的项选中
                    $("#sample_name").val(selected.id);
                    $("#sample_name").trigger("change");
                }
            }
        });

    }, 'json');
});
